<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="ss"%>
<jsp:include page="../header.jsp" />
<div id="content">
	<div id="topstory" class="box">
		<h1>
			<fmt:message key="user.title.edit" />
		</h1>
	</div>
	<div class="padding">
		<c:choose>
			<c:when test="${ borrowView != null}">
				<c:if test="${not empty formErrors}">
					<div class="ui-widget">
						<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
							<p>
								<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
								<c:forEach var="error" items="${errors }">
									<strong>Error:</strong>
									<c:out value="${error.message}" />
								</c:forEach>


							</p>
						</div>
					</div>
				</c:if>
				<c:if test="${not empty message}">
					<div class="ui-widget">
						<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
							<p>
								<span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
									<strong>Info:</strong>
									<c:out value="${message}" />
							</p>
						</div>
					</div>
				</c:if>
				<form:form action="submitBorrowedBook.do" commandName="borrowView" method="POST">
					<table border="0" cellspacing="5" cellpadding="0" width="100%" class="formTable tplBorder">
						<tr>
							<td width="15%"></td>
							<td width="35%"></td>
							<td width="15%"></td>
							<td width="35%"></td>
						</tr>
						<tr>
							<td class="label"><fmt:message key="user" /></td>
							<td><form:select items="${borrowView.userList }" itemLabel="label" itemValue="id" path="userId" /></td>
							<td class="label"><fmt:message key="user" /></td>
							<td><form:select items="${borrowView.bookList }" multiple="true" itemLabel="nazev" itemValue="id" path="bookIds" /></td>
						</tr>
						<tr>
							<td colspan="2"><input type="submit" /></td>
							<td colspan="2"><input type="button" onclick="javascript:window.location = 'books.do'" value="Cancel" /></td>
						</tr>
					</table>
				</form:form>
			</c:when>
			<c:otherwise>
				<h3>${error }</h3>
			</c:otherwise>
		</c:choose>
	</div>
	<!-- /padding -->
</div>
<!-- /content -->
<jsp:include page="side-menu.jsp" />
<jsp:include page="../foother.jsp" />
